<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>我mai 注册</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<link rel="stylesheet" type="text/css" href="css/my.css">

		<script type="text/javascript">
function validate_email(field, msg) {
	with (field) {
		apos = value.indexOf("@")
		dotpos = value.lastIndexOf(".")
		if (apos < 1 || dotpos - apos < 2) {
			document.getElementById("preview").innerHTML = msg;
			return false
		} else {
			document.getElementById("preview").innerHTML = "";
			return true
		}
	}
}

function validate_password(p1, p2, msg) {
	with (p1, p2) {
		pword1 = p1.value;
		pword2 = p2.value;

		if (pword1 != pword2) {
			document.getElementById("preview2").innerHTML = msg;
			return false
		} else {
			document.getElementById("preview2").innerHTML = "";
			return true
		}
	}
}

function validate_nullpassword(p1, msg) {
	with (p1) {

		if (p1.value.length == 0) {
			document.getElementById("preview3").innerHTML = msg;
			return false
		} else {
			document.getElementById("preview3").innerHTML = "";
			return true
		}
	}
}

function validate_nullemail(e1, msg) {
	with (e1) {

		if (e1.value.length == 0) {
			document.getElementById("preview").innerHTML = msg;
			return false
		} else {
			return true
		}
	}
}

function validate_nullname(n1, msg) {
	with (n1) {

		if (n1.value.length == 0) {
			document.getElementById("preview4").innerHTML = msg;
			return false
		} else {
			document.getElementById("preview4").innerHTML = "";
			return true
		}
	}
}

function validate_form(thisform) {
with (thisform) {
		var mark = 0;
		if(validate_nullname(customerName, "用户名不能为空") == false){
		mark = 1;
		}
		
		if (validate_email(email, "邮箱格式不正确") == false) {
			//email.focus();
			mark = 1;
		}
		
		if(validate_nullemail(email, "邮箱不能为空") == false){
			mark = 1;
		}
		
		if (validate_password(password, passwordSecond, "密码输入不一致") == false) {
			mark = 1;
		}
		if (validate_nullpassword(password, "密码不能为空") == false) {
			mark = 1;
		}
		if (mark == 0) {
			return true
		} else {
			return false
		}
	}
}
</script>

	</head>

	<body>
		<form name="myForm3" action="registerAction.do" method="post"
			onsubmit="return validate_form(this);">
			<table width="50%" border="0" align="center">
				<tr>
					<td>
						<img src="img/1.bmp" />
					</td>
				</tr>
				<tr>
					<td class="style1">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td class="style1">
						注册新用户
					</td>
				</tr>
				<tr>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td>
						<div align="left">
							<span class="style2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								请输入用户名：</span>
							<input name="customerName" type="text" size="30" />
						</div>
					</td>
					<td>
						<div id="preview4"
							style="border: 0 solid #808080; width: 100%; height: 20px; color: #FF6600; padding: 5px;"></div>


					</td>
				</tr>


				<tr>
					<td colspan="2">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td>
						<div align="left">
							<span class="style2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请输入E-mail地址：</span>
							<input name="email" type="text" size="30" />
						</div>
					</td>
					<td>
						<div id="preview"
							style="border: 0 solid #808080; width: 100%; height: 20px; color: #FF6600; padding: 5px;"></div>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						&nbsp;
					</td>
				</tr>

				<tr>
					<td>
						<div align="left">
							<span class="style2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								&nbsp; &nbsp; 请输入密码：</span>
							<input name="password" type="password" maxlength="12" />
						</div>
					</td>
					<td>
						<div id="preview3"
							style="border: 0 solid #808080; width: 100%; height: 20px; color: #FF6600; padding: 5px;"></div>
					</td>
				</tr>
				<tr>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<td>
						<div align="left">
							<span class="style2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								再次输入：</span>
							<input name="passwordSecond" type="password" maxlength="12" />
						</div>
					</td>
					<td>
						<div id="preview2"
							style="border: 0 solid #808080; width: 100%; height: 20px; color: #FF6600; padding: 5px;"></div>


					</td>
					</td>
				</tr>
				<tr>
					<td>

					</td>
				</tr>
				<tr>
					<td>
						<div align="left">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
							&nbsp;
							<input type="submit" name="Submit" value="完成" />
						</div>
					</td>
				</tr>
				<tr>
					<td>
						<hr />
						&nbsp;
					</td>
				</tr>
				<tr>
					<td>
						&nbsp;
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>
